import { Column, CreateDateColumn, Entity, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm';
import { IsDate } from 'class-validator';

@Entity('shop-cart')
export class CartEntity {
  @PrimaryGeneratedColumn()
  id: number;

  @Column({ comment: '用户ID' })
  userId: number;

  @Column({ comment: '商品ID' })
  productId: number;

  @Column({ comment: '商品名称' })
  productName: string;

  @Column({ comment: '商品主图' })
  image: string;

  @Column({ type: 'decimal', precision: 10, scale: 2, comment: '商品价格' })
  price: number;

  @Column({ type: 'int', default: 1, comment: '商品数量' })
  quantity: number;

  @Column({ default: true, comment: '是否选中' })
  selected: boolean;

  @CreateDateColumn({ comment: '创建时间' })
  createTime: Date;

  @UpdateDateColumn({ comment: '更新时间' })
  updateTime: Date;
}
